package com.mixue.restful;

import lombok.Data;

import java.util.HashMap;
import java.util.Map;

@Data
//返回结果集设置
public class ResoutSet<T>{
    private Integer code; //1是成功  其他数字是失败
    private String msg; //错误信息
    private T data; //返回数据
    private Map map=new HashMap();
    public static <T> ResoutSet<T> sussess(T data){
        ResoutSet<T> resoutSet=new ResoutSet<>();
        resoutSet.code=1;
        resoutSet.data=data;
        return resoutSet;
    }
    public static <T> ResoutSet<T> error(String msg){
        ResoutSet<T> resoutSet=new ResoutSet<>();
        resoutSet.msg=msg;
        resoutSet.code=0;
        return resoutSet;
    }
    public ResoutSet<T> add(String key,Object value){
        this.map.put(key,value);
        return this;
    }
}


